Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use type switch for checking color type #43

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

DaveSaah
Copy link
Contributor

@DaveSaah DaveSaah commented Dec 11, 2023

Addresses #35

Changes

  • Break if statements for color type checking into switch cases.

    switch v := b.TitleColor.(type) {
        case string:
        ...
        case uint:
        ...
        case [3]uint:
        ...
        default:
        ...
    }
  • Replace hard coded boolean expression with a variable.

    titleContainsNewLine := strings.Contains(title, "\n")

Copy link
Owner

@Delta456 Delta456 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I appreciate it. It would help if you also changed the functions obtainContentColor and obtainBoxColor.

@DaveSaah
Copy link
Contributor Author

Alright, noted ✅️

@DaveSaah
Copy link
Contributor Author

  • refactor obtainContentColor
  • refactor obtainBoxColor

Copy link
Owner

@Delta456 Delta456 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@Delta456 Delta456 merged commit 1ac023b into Delta456:master Dec 13, 2023
1 check passed
Delta456 added a commit that referenced this pull request Jun 20, 2024
* Updated the dependencies in go.mod  (#40)

* updated dependencies

* removed the extra folder

* README.md: use simpler words (#41)

* all: use type switch for checking color type (#43)

---------

Co-authored-by: sanvi <[email protected]>
Co-authored-by: David Saah <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants